<?php
    include("/fckeditor/fckeditor.php") ;
?>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script>
    $(document).ready(function(){
        $("#language").change(function() {
            $.ajax({  
              type: "POST",
              url: "<?php echo site_url(); ?>/menu/menu_controller/return_json_language_menu",
              dataType: 'json',
              data: {language_id: 1},
                success: function(data) {
                    console.log(data[0]);
//                    $('#ac_background .ac_bgimage').attr('src', "<?php echo FILEPATH; ?>"+'bg/'+data[0].url);
//                    $('.ac_menu').html('');
//                    for(var item in data){
//                        var picUrl = "<?php echo FILEPATH; ?>"+'bg/'+item.url;
//                        $('.ac_menu').append('<li><a href="'+picUrl+'"></a></li>')
//                    }
                }
            });
        });
    });   
</script>
<h2>Add page</h2>
<form method="POST" action="<?php echo site_url() . "/content/content_controller/set"; ?>">
<table cellpadding="0" cellspacing="0" width="100%">
    <thead>
        <tr>
            <th colspan="2">Pages</th>
        </tr>  
    </thead>
    
        <tbody>
            <tr>
                <td>Page name</td>
                <td><input type="text" name="name" value="" /></td>
            </tr>
<!--
            <tr>
                <td>Page type</td>
                <td>
                    <select name="">
                        <option>template 1</option>
                        <option>template 2</option>
                    </select>
                </td>
            </tr>
-->
            <?php
                if(!empty($languages)) {
            ?>
                <tr>
                    <td>Language</td>
                    <td>
                        <select name="language">
                                <?php
                                    if(!empty($language)) {
                                ?>
                                        <option value=<?php echo $language['language_id'] ?>><?php echo $language['name'] ?></option>
                                <?php
                                    }
                                ?>
                                <?php
                                    foreach($languages as $key => $language) {
                                ?>
                                    <option value=<?php echo $language['language_id'] ?>><?php echo $language['name'] ?></option>
                                <?php
                                    }
                                ?>
                        </select>
                    </td>
                </tr>
            <?php
                }
            ?>
            <?php
                if(!empty($options)) {
            ?>
                    <tr>
                        <td>Menu</td>
                        <td>`                
                            <select name="parent">
                                    <?php
                                        foreach($options as $key => $option) {
                                    ?>
                                        <option value=<?php echo $option['menu_id'] ?>><?php echo $option['title'] ?></option>
                                    <?php
                                        }
                                    ?>
                            </select>
                        </td>
                    </tr>
            <?php
                }
            ?>            
            <tr>
                <?php
                    $sBasePath = '/agent24/application/views/cms_pages/fckeditor/' ;
                    $oFCKeditor = new FCKeditor('content') ;
                    $oFCKeditor->BasePath = $sBasePath;
                    $oFCKeditor->Config['SkinPath'] = $sBasePath . 'editor/skins/office2003/';
                    $oFCKeditor->Value = '';
                    $oFCKeditor->Width = '100%';
                    $oFCKeditor->Heigth = '100%';
                    $oFCKeditor->Create();
                ?>
            </tr>
        </tbody>
    <tfoot>
    <td colspan="2">
        <button>Add page</button>
    </td>
</tfoot>
</table>
</form>